<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php echo $this->headTitle()?>
<?php echo $this->headMeta();?>
<link type="text/css" rel="stylesheet" href="<?php echo PUBLIC_URL."/skins/default/css/style.css";?>"/>
<link type="text/css" rel="stylesheet" href="<?php echo PUBLIC_URL."/skins/default/css/skin.css";?>"/>
<link type="text/css" rel="stylesheet" href="<?php echo PUBLIC_URL."/skins/default/css/jquery.lightbox-0.5.css";?>"/>
<link type="text/css" rel="stylesheet" href="<?php echo PUBLIC_URL."/skins/default/css/galleria.classic.css";?>"/>
<script type="text/javascript" src="<?php echo PUBLIC_URL."/skins/default/js/jquery.js";?>"></script>
<script type="text/javascript" src="<?php echo PUBLIC_URL."/skins/default/js/jcarousel.js";?>"></script>
<script type="text/javascript" src="<?php echo PUBLIC_URL."/skins/default/js/jquery.lightbox-0.5.min.js";?>"></script>
<script type="text/javascript" src="<?php echo PUBLIC_URL."/skins/default/js/jquery.timers.js";?>"></script>
<script type="text/javascript" src="<?php echo PUBLIC_URL."/skins/default/js/jquery.selectbox-0.5.js";?>"></script>
<script type="text/javascript" src="<?php echo PUBLIC_URL."/skins/default/js/galleria-1.2.6.min.js";?>"></script>
<script type="text/javascript" src="<?php echo PUBLIC_URL."/skins/default/js/jquery-blink.js";?>"></script>
<script type="text/javascript">

$(document).ready(function(){
    $("#accessories .b-title h3 a span, #boxes .b-title h3 a span").blink();
			
    $("#accessories ul").jcarousel({
        vertical: true,
        scroll: 1,
	auto: 5,
	wrap: "last"
    });
    $("#boxes ul").jcarousel({
        vertical: true,
        scroll: 1,
	auto: 5,
	wrap: "last"
    });
    //script for slide
    $("#s-buttons a").click(function(){
        if(!$(this).hasClass("current")){
            var index = $(this).index();
            $("#s-buttons a.current").removeClass("current");
            $(this).addClass("current");
            $("#slide .s-item.current").fadeOut(1000).removeClass("current");
            $("#slide .s-item").eq(index).fadeIn(1000).addClass("current");
        }
        return false;
    });
    $(this).everyTime(5000, 'changeImage', function(){
        var index = $("#slide .s-item.current").index() + 1;
        if(index == $("#slide .s-item").length) index = 0;
        $("#slide .s-item.current").fadeOut(1000).removeClass("current");
        $("#slide .s-item").eq(index).fadeIn(1000).addClass("current");
        $("#s-buttons a.current").removeClass("current");
        $("#s-buttons a").eq(index).addClass("current");
    });
    $("#slCategory,#slType").selectbox();
    $("#slType_input").next().css("left", 85);
    $(".keyword").focus(function(){
        $(this).attr("value","");
    });
    $("#search").submit(function(){
        var key = $(".keyword").attr("value");
        if(key == "" || key =="Nhập tên sản phẩm..."){
            alert("Xin nhập tên sản phẩm bạn muốn tìm!");
            return false;
        }
    });
    $("a[rel=lightbox]").lightBox({
     imageLoading : "<?php echo PUBLIC_URL."/skins/default/images/lightbox-ico-loading.gif"?>",
     imageBtnPrev: "<?php echo PUBLIC_URL."/skins/default/images/lightbox-btn-prev.gif"?>",
     imageBtnNext: "<?php echo PUBLIC_URL."/skins/default/images/lightbox-btn-next.gif"?>",
     imageBtnClose:"<?php echo PUBLIC_URL."/skins/default/images/lightbox-btn-close.gif"?>",
     imageBlank: "<?php echo PUBLIC_URL."/skins/default/images/lightbox-blank.gif"?>"
    });
    //tìm chiều cao lớn nhất gán cho tất cả các produc
    var products = $(".product");
    var maxHeight = 0;
    for(var i = 0; i< products.length; i++){
        
        if(products.eq(i).height() > maxHeight) maxHeight = products.eq(i).height();
    }
    products.height(maxHeight);
    var priceSpans = $("span.price");
    for(i = 0; i< priceSpans.length; i++){
        if(priceSpans.eq(i).html() == "Giá: 0"){
            priceSpans.eq(i).html("Giá: Call");
        }
    }
   
});
</script>
</head>
<body>
<div id="header-outter">
	<div id="header">
		<div id="h-wrapper">
			<div class="hw-left"></div>
			<div class="hw-center">
				<div id="h-background">
					<div class="hb-top-left"></div>
					<div class="hb-top-center"></div>
					<div class="hb-top-right"></div>
					<div class="hb-mid"></div>
					<div class="hb-bottom-left"></div>
					<div class="hb-bottom-center"></div>
					<div class="hb-bottom-right"></div>
				</div>
			</div>
			<div class="hw-right"></div>
		</div>
		<div id="h-container">
			<div id = "logo">
				<a href="/">
					<img src="<?php echo PUBLIC_URL."/skins/default";?>/images/logo.png" alt="anthaiauto"/>
				</a>
			</div>
			<div id="h-menu" class="main-menu">
				<ul>
                            <li class="first">&nbsp;</li>
                            <?php
                            try{
                                if(isset($this->menus) && count($this->menus) > 0){
                                    foreach($this->menus as $menu){

                            ?>
                             <li>
                                  <a href="<?php echo $menu->link;?>"><?php echo $menu->name;?></a>
                             </li>
                            <?php
                                    }
                                }
                            }  catch (Exception $ex){
                                echo $ex->getTraceAsString();
                            }
                            ?>
                                   
				</ul>
			</div>
                  <div id="slide">
<!--                        <div class="s-blur"></div>-->
                        <div class="s-wrapper">
                            <?php
                            try{
                                $numOfImages = 0;
                                $i = 0;
                                if(isset($this->slideImages) && count($this->slideImages) > 0){
                                        $numOfImages = count($this->slideImages);
                                        foreach($this->slideImages as $slideImage){
                                            $i++;

                            ?>
                                <div class="s-item <?php echo ($i == 1) ? " current" : "";?>">
                                        <div class="si-picture">
                                                <img src="<?php echo $slideImage->src;?>" width="900px" height="280px" alt="anthaiauto.com"/>
                                        </div>
                                        
                                </div>
                              <?php

                                        }
                              ?>
                                                <div class="clearfix"></div>
                        <?php
                                }
                            

                        ?>
                        </div>
                        <div id="s-buttons">
                                <div>
                                    <?php
                                    for($i = 0; $i < $numOfImages; $i++){
                                        echo "<a ". (($i == 0) ? "class='current'" : ""). " href='#'><span>".($i+1)."</span></a>";
                                    }
                                    ?>

                                </div>
                        </div>
                        <?php
                            }  catch (Exception $ex){
                                echo $ex->getTraceAsString();
                            }
                        ?>
                    </div><!-- end of #slide  -->
                <div id="time">
                    <?php
                        $date = gmdate(" l d-m-Y ");
                        if(strstr( $date, "Monday")) $date = str_replace("Monday", "Thứ Hai, ngày ", $date);
                        if(strstr( $date, "Tuesday")) $date = str_replace("Tuesday", "Thứ Ba, ngày", $date);
                        if(strstr($date ,"Wednesday" )) $date = str_replace("Wednesday", "Thứ Tư, ngày", $date);
                        if(strstr( $date,"Thursday")) $date = str_replace("Thursday", "Thứ Năm, ngày", $date);
                        if(strstr($date, "Friday")) $date = str_replace("Friday", "Thứ Sáu, ngày", $date);
                        if(strstr($date, "Saturday")) $date = str_replace("Saturday", "Thứ Bảy, ngày", $date);
                        if(strstr($date,"Sunday" )) $date = str_replace("Sunday", "Chủ Nhật, ngày", $date);
                        echo $date;
                    ?>
                </div><!-- end of #time-->
                <form id="search" action="<?php echo $this->url(array(), "search");?>" method="post">
                    <div class="search-left"></div>
                    <div class="search-mid">
                        <select id = "slCategory" name="category_id" style="border: none;">
                            <option value ="0">Hãng xe</option>
                            <?php
                            foreach ($this->mCategories as $category){
                                echo "<option value='".$category->id."'>".$category->name."</option>";
                            }
                            ?>
                        </select>
                        <select id = "slType" name="type" style="border: none; background: none;">
                            <option value ="">Sản phẩm</option>
                            <option value ="car">Xe</option>
                            <option value ="accessory">Phụ tùng</option>
                            <option value ="box">Thùng bệ</option>
                        </select>
                        <input type="textbox" name="key" size="18" class="keyword" value="Nhập tên sản phẩm..."/>
                        <input type ="submit" class="btnSubmit" value=""/>
                    </div>
                    <div class="search-right"></div>

                </form>
	</div><!-- end of #h-container  -->
    </div><!-- end of #header -->
</div><!-- end of #header-outter -->
<div id="main">
	<div id="m-wrapper">
		<div class="mw-left"></div>
		<div class="mw-center">
			<div id="m-container">
				<div class="mc-top-left"></div>
				<div class="mc-top-center"></div>
				<div class="mc-top-right"></div>	
				<div class="mc-mid">
					<div id="m-left" class="mc-mid-left">
						<div id="categories">
							<div class="c-head">
								<h3>Sản phẩm</h3>
							</div>
							<ul class="c-wrapper">
								<?php
								try{
								if(isset($this->mCategories) && count($this->mCategories) > 0){
									foreach ($this->mCategories as $category){
								?>
								<li><a href="<?php echo $this->url(array("type"=> "car", "slug" =>  $category->slug), "category_view");?>"><?php echo $category->name;?></a></li>
								<?php			
									}
								}
								}catch (Exception $ex){
									echo $ex->getMessage();
								}
								?>
								
							</ul>
						</div><!-- end of #categories -->
						<div id="accessories" class="box">
							<div class="b-title">
								<h3><a href="<?php echo $this->url(array("cat_slug"=> "", "page" => ""),"accessory_view");?>" title=""><span>Phụ tùng xe</span></a></h3>
								
								<img src="<?php echo PUBLIC_URL."/skins/default";?>/images/arrow.png" alt="" />
							</div>
							<ul class="b-container jcarousel">
								<?php
								try{
									if(isset($this->featuredAccessories) && count($this->featuredAccessories)> 0){
										foreach ($this->featuredAccessories as $featuredAccessory){
											$arrImages = explode('@', $featuredAccessory->feature_image);
										
								?>
								<li>
									<h3><a href="<?php echo $this->url(array("slug" => $featuredAccessory->slug), "post_view");?>"><?php echo $featuredAccessory->title?></a></h3>
									<a href="<?php echo $this->url(array("slug" => $featuredAccessory->slug), "post_view");?>">
									<img src="<?php echo $arrImages[0]?>" alt="" width="185px" height="100px"/>
									</a>
									<p><?php echo $featuredAccessory->summary;?></p>
									<a class="readmore" href="<?php echo $this->url(array("slug" => $featuredAccessory->slug), "post_view");?>">&raquo; Chi tiết</a>
									<span class="price">Giá: <?php echo number_format($featuredAccessory->price)?></span>
								</li>
								<?php			
										}
									}	
									
								}catch (Exception $ex){
									echo $ex->getMessage();
								}
								?>
								
							</ul>
						</div><!-- end of #accessories -->
						<div id="boxes" class="box">
							<div class="b-title">
                                <h3><a href="<?php echo $this->url(array("cat_slug"=> "", "page" => ""),"box_view");?>" title=""><span>Xưởng đóng thùng</span></a></h3>
								<img src="<?php echo PUBLIC_URL."/skins/default";?>/images/arrow.png" alt=""/>
							</div>
							<ul class="b-container jcarousel">
								<?php
								try{
									if(isset($this->featuredBoxes) && count($this->featuredBoxes)> 0){
										foreach ($this->featuredBoxes as $featuredBox){
											$arrImages = explode('@', $featuredBox->feature_image);
										
								?>
								<li>
									<h3><a href="<?php echo $this->url(array("slug" => $featuredBox->slug), "post_view");?>"><?php echo $featuredBox->title?></a></h3>
									<a href="<?php echo $this->url(array("slug" => $featuredBox->slug), "post_view");?>">
									<img src="<?php echo $arrImages[0]?>" alt="" width="185px" height="100px"/>
									</a>
									<p><?php echo $featuredBox->summary;?></p>
									<a class="readmore" href="<?php echo $this->url(array("slug" => $featuredBox->slug), "post_view");?>">&raquo; Chi tiết</a>
									<span class="price">Giá: <?php echo number_format($featuredBox->price)?></span>
								</li>
								<?php			
									}
								}
									
								}catch (Exception $ex){
									echo $ex->getMessage();
								}
								?>
							</ul>
						</div><!-- end of #boxes -->
                                    <div id="counter">
                                        
                                            <!-- Histats.com  START  (standard)-->
                                            <script type="text/javascript">document.write(unescape("%3Cscript src=%27http://s10.histats.com/js15.js%27 type=%27text/javascript%27%3E%3C/script%3E"));</script>
                                            <a href="http://www.histats.com" target="_blank" title="free html hit counter" ><script  type="text/javascript" >
                                            try {Histats.start(1,1748346,4,3018,180,100,"00011001");
                                            Histats.track_hits();} catch(err){};
                                            </script></a>
                                            <noscript><a href="http://www.histats.com" target="_blank"><img  src="http://sstatic1.histats.com/0.gif?1748346&101" alt="free html hit counter" border="0"></a></noscript>
                                            <!-- Histats.com  END  -->
                                    </div>
					</div><!-- end of #m-left -->
					<div id="m-center" class="mc-mid-center">
						<?php echo $this->layout()->content;?>
						
					</div><!--end of #m-center-->
					<div id="m-right" class="mc-mid-right">
						<div id="supporters">
							<div class="s-top">
								Hỗ trợ khách hàng
							</div>
							<div class="s-container">
								<?php
								try{
									if(isset($this->supporters) && count($this->supporters) > 0){
                                                                                $i = 0;
										foreach ($this->supporters as $supporter){


								?>
								<div class="supporter <?php if($i==0) echo "first"; if($i==count($this->supporters)-1) echo "last";?>">
									<a href="ymsgr:SendIM?<?php echo $supporter->yahoo_account;?>" title = "Chat với <?php echo $supporter->name;?>">
										<span>
											<span class="job"><?php if($supporter->type == 0)echo "Tư vấn bán hàng"; ?></span>
											<span class="name"><?php echo $supporter->name;?></span>
											<span class="phone"><?php echo $supporter->phone;?></span>
										</span>
										<img alt="" src="http://opi.yahoo.com/online?u=<?php echo $supporter->yahoo_account;?>&m=g&t=14" width="50px"/>
									</a>
								</div>
								<?php
                                                                                    $i++;
										}
									}
								}catch(Exception $ex){
									echo $ex->getMessage();
								}
								?>
								
							</div>
							<div class="s-bottom"></div>
						</div>
						<div id="news" class="box">
							<div class="b-title">
								<h3><a href="<?php echo $this->url(array("page" =>""), "news_view");?>">Tin tức</a></h3>
							</div>
							<div class="b-container">
								<ul>
								<?php
								try{
									if(isset($this->lastestNewses) && count($this->lastestNewses) > 0){
										foreach ($this->lastestNewses as $lastestNewses){
											echo "<li><a href='".$this->url(array("slug"=> $lastestNewses->slug), "post_view")."'>".$lastestNewses->title."</a></li>\n";
										}
									}
								}catch (Exception $ex){
									echo $ex->getMessage();
								}
								?>
									
								</ul>
                                              <div class="readmore">
                                                  <a href="<?php echo $this->url(array(""), "news_view");?>">&raquo; Xem tiếp</a>
                                              </div>
							</div>
						</div>
						<div id="banners" class="box">
							<div class="b-title">
								<h3>Quảng cáo</h3>
							</div>
							<div class="b-container">
                                              <?php
                                              try{
                                                  if(isset($this->banners) && count($this->banners) > 0){
                                                      foreach ($this->banners as $banner){
                                                          if($banner->link != ""){
                                                              echo "<a href='".$banner->link."'>";
                                                              echo "<img src='" .$banner->src."' alt='' width='188px'/>";
                                                              echo "</a>";

                                                          }else{
                                                                echo "<img src='" .$banner->src."' alt='' width='188px'/>";
                                                          }
                                                      }
                                                  }
                                                  
                                              }catch(Exception $ex){
                                                  echo $ex->getMessage();
                                              }
                                              ?>
                                              
							</div>
						</div><!-- end of #banners.box -->
                                    
					</div><!-- end of #m-right -->
					<div class="clearfix"></div>
				</div><!--end of #mc-mid-->
				<div class="mc-bottom-left"></div>
				<div class="mc-bottom-center"></div>
				<div class="mc-bottom-right"></div>
				<div class="clearfix"></div>
			</div><!--end of #m-container -->
		</div>
			
		<div class="mw-right"></div>
		<div class="clearfix"></div>
	</div> 
</div><!-- end of #main -->
<div id="footer">
	<div id="f-wrapper">
		<div class="fw-left"></div>
		<div class="fw-center">
			<div id="f-background">
				<div class="fb-top-left"></div>
				<div class="fb-top-center"></div>
				<div class="fb-top-right"></div>
				<div class="fb-mid"></div>
				<div class="fb-bottom-left"></div>
				<div class="fb-bottom-center"></div>
				<div class="fb-bottom-right"></div>
				<div class="fb-smoke"></div>
			</div>
		</div>
		<div class="fw-right"></div>
		
	</div>
	<div id="f-container">
		<div id="f-menu" class="main-menu">
			<ul>
                      <li class="first">&nbsp;</li>
                  <?php
                            try{
                                if(isset($this->menus) && count($this->menus) > 0){
                                    foreach($this->menus as $menu){
                            ?>
                             <li>
                                  <a href="<?php echo $menu->link;?>"><?php echo $menu->name;?></a>
                             </li>
                            <?php
                                    }
                                }
                            }  catch (Exception $ex){
                                echo $ex->getTraceAsString();
                            }
                            ?>
                        </ul>
		</div>
		<div id = "f-logo">
			<a href="/"><img src="<?php echo PUBLIC_URL."/skins/default";?>/images/logo.png" alt="anthaiauto" width="80%"/></a>
			<p>
                      Bản quyển  thuộc về công ty An Thai Auto<br/>
                      Địa chỉ : Km8 đường 1A-Hoàng Liệt - Hoàng Mai - Hà Nội <br/>
                      Liên hệ: Mr Nguyễn Văn Thái - 0919.39.38.36<br/>
                      Website được thực hiện bởi <a style ="text-decoration: underline; color: #034954;" href="http://idgit.com.vn" title="Chuyển tới trang chủ IDG-IT">IDG-IT</a>
                  </p>
		</div>
          <div id="counter" style="position: absolute; top: 80px; right: 120px;">
              
          </div>
	</div>
</div>
</body>
</html>
